#include "lvgl/lvgl.h"

/*******************************************************************************
 * Size: 15 px
 * Bpp: 4
 * Opts: 
 ******************************************************************************/

#ifndef MY_FONT_ICON
#define MY_FONT_ICON 1
#endif

#if MY_FONT_ICON

/*-----------------
 *    BITMAPS
 *----------------*/

/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
    /* U+E638 "" */
    0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x7, 0xdf, 0xff, 0xc7, 0x0, 0x0, 0x0,
    0x3e, 0xff, 0xff, 0xff, 0xfe, 0x30, 0x0, 0x3f,
    0xff, 0xff, 0xff, 0xff, 0xff, 0x30, 0xd, 0xf7,
    0x29, 0xa8, 0x99, 0x26, 0xfd, 0x6, 0xff, 0x60,
    0x0, 0x0, 0x0, 0x5f, 0xf6, 0xbf, 0xf2, 0x0,
    0x0, 0x0, 0x2, 0xff, 0xbe, 0xfd, 0x0, 0x0,
    0x0, 0x0, 0xc, 0xfe, 0xff, 0xc0, 0x0, 0x0,
    0x0, 0x0, 0xbf, 0xfe, 0xff, 0x0, 0x0, 0x0,
    0x0, 0xe, 0xfe, 0xaf, 0xf8, 0x0, 0x0, 0x0,
    0x7, 0xff, 0xa4, 0xf8, 0xec, 0x70, 0x0, 0x6c,
    0xff, 0xf4, 0xb, 0xd3, 0xc9, 0x0, 0xb, 0xff,
    0xfb, 0x0, 0x1d, 0xa3, 0x20, 0x0, 0x9f, 0xfd,
    0x10, 0x0, 0x1b, 0xfa, 0x0, 0x9, 0xfb, 0x10,
    0x0, 0x0, 0x3, 0x40, 0x0, 0x43, 0x0, 0x0,

    /* U+E639 "" */
    0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0x0,
    0x0, 0x1, 0x53, 0x0, 0x0, 0x0, 0xf0, 0x0,
    0x0, 0x3f, 0xa0, 0x0, 0x0, 0xf, 0x0, 0x0,
    0x3, 0xfa, 0x0, 0x0, 0x0, 0xf0, 0x0, 0x0,
    0x3f, 0xa0, 0x68, 0x0, 0xf, 0x0, 0x0, 0x3,
    0xfa, 0xc, 0xf1, 0x0, 0xf0, 0xa, 0x70, 0x3f,
    0xa0, 0xcf, 0x10, 0xf, 0x1, 0xfc, 0x3, 0xfa,
    0xc, 0xf1, 0x0, 0xf0, 0x1f, 0xc0, 0x3f, 0xa0,
    0xcf, 0x10, 0xf, 0x1, 0xfc, 0x3, 0xfa, 0xc,
    0xf1, 0x0, 0xf0, 0x1f, 0xc0, 0x3f, 0xa0, 0xcf,
    0x10, 0xf, 0x0, 0x10, 0x0, 0x10, 0x0, 0x10,
    0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xf0,

    /* U+E63A "" */
    0x11, 0x0, 0x0, 0x0, 0x0, 0x4, 0xde, 0xb5,
    0x0, 0x0, 0x0, 0x0, 0x4, 0xad, 0x30, 0x0,
    0x0, 0x0, 0x0, 0x4e, 0x40, 0x0, 0x4a, 0x60,
    0x0, 0x2e, 0x30, 0x1, 0x49, 0xe3, 0x0, 0x4c,
    0x0, 0x0, 0x3, 0xe2, 0x0, 0xb5, 0x0, 0x0,
    0x5, 0xb0, 0x5, 0xa0, 0x5c, 0x10, 0xe, 0x10,
    0x1d, 0x4, 0xd5, 0x0, 0x92, 0x0, 0xc0
};


/*---------------------
 *  GLYPH DESCRIPTION
 *--------------------*/

static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
    {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
    {.bitmap_index = 0, .adv_w = 240, .box_w = 15, .box_h = 16, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 120, .adv_w = 240, .box_w = 15, .box_h = 15, .ofs_x = 0, .ofs_y = -1},
    {.bitmap_index = 233, .adv_w = 240, .box_w = 11, .box_h = 10, .ofs_x = 2, .ofs_y = 1}
};

/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/



/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 58936, .range_length = 3, .glyph_id_start = 1,
        .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
    }
};



/*--------------------
 *  ALL CUSTOM DATA
 *--------------------*/

/*Store all the custom data of the font*/
static lv_font_fmt_txt_dsc_t font_dsc = {
    .glyph_bitmap = gylph_bitmap,
    .glyph_dsc = glyph_dsc,
    .cmaps = cmaps,
    .kern_dsc = NULL,
    .kern_scale = 0,
    .cmap_num = 1,
    .bpp = 4,
    .kern_classes = 0,
    .bitmap_format = 0
};


/*-----------------
 *  PUBLIC FONT
 *----------------*/

/*Initialize a public general font descriptor*/
lv_font_t my_font_icon = {
    .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,    /*Function pointer to get glyph's data*/
    .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,    /*Function pointer to get glyph's bitmap*/
    .line_height = 16,          /*The maximum line height required by the font*/
    .base_line = 2,             /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
    .subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0)
    .underline_position = 0,
    .underline_thickness = 0,
#endif
    .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};



#endif /*#if MY_FONT_ICON*/

